export default {
    state: {
        menulist: [],
        page: 1,
        size: 20,
        total: 0
    },
    getters: {
        getters_menulist(state) {
            return state.menulist
        },
        getters_page(state) {
            return state.page
        },
        getters_total(state) {
            return state.total
        }
    },
    mutations: {
        mutations_menulist(state, payload) {
            state.menulist = payload
        },
        mutations_page(state, payload) {
            state.page = payload
        },
        mutations_total(state, payload) {
            state.total = payload
        }
    },
    actions: {
        async actions_menulist(context, payload) {
            try {
                // let data = {
                //     page: context.state.page,
                //     size: context.state.size
                // }
                // let res = await get_menulist(data);
                // if (res.code == 200) {
                //     if (res.list == null && context.state.page != 1) {
                //         context.commit('mutations_page', context.state.page - 1)
                //         context.dispatch('actions_menulist')
                //     } else {
                //         context.commit('mutations_menulist', res.list)
                //         context.commit('mutations_total', res.total)
                //     }
                // }
            } catch (err) {
                console.log(err);
            }
        }
    },
    namespaced: true
}